package main

import (
	"fmt"
	"time"
)

func main() {
	c5 := make(chan int, 5)
	c5 <- 111
	c5 <- 222
	c5 <- 333

	go func() {
		defer close(c5)
		c := 1000
		for {
			c5 <- c
			c++
			if c > 1010 {
				break
			}
		}
		fmt.Println("协程结束了")
	}()

	fmt.Println(<-c5, "###")
	for v := range c5 {
		time.Sleep(time.Second)
		fmt.Println(v, "$$$")
	}
	fmt.Println("~~~~~~~~~~~~~~~~~~~~~~~")
}
